#ifndef __TOOLS_HPP__
#define __TOOLS_HPP__
#ifdef __cplusplus
extern "C"
{
#endif
#include "stdint.h"
#ifdef __cplusplus
}
#endif

#define _SQRT3_3         0.57735026f
#define _SQRT3_2_3       1.154700538f
#include "Time.hpp"
typedef struct{
    float I_alpha;
    float I_beta;
    float Ia;
    float Ib;
    float Ic;
}ClarkeParame,*ClarkeParame_P;

typedef struct{
    float I_alpha;
    float I_beta;
    float Id;
    float Iq;
    float Angle_Cos;
    float Angle_Sin;
}ParkParame,*ParkParame_P;

void ClarkeTransformation(ClarkeParame_P Clarke);
void ParkTransformation(ParkParame_P Park);


class LowPassFilter
{
public:
    LowPassFilter() = default;

    explicit LowPassFilter(float _timeConstant)
        : timeConstant(_timeConstant), outputLast(0.0f)
    {
        timeStamp = Time::getTime();
    }

    float operator()(float _input);
    uint16_t operator()(uint16_t _input);
    float timeConstant;


protected:
    float timeStamp;
    float outputLast;
};

#endif